package nl.hanze.designpatterns.mvc.controller;

import java.awt.event.ActionEvent;

import nl.hanze.designpatterns.mvc.application.Application;
import nl.hanze.designpatterns.mvc.gui.DashboardGUI;
import nl.hanze.designpatterns.mvc.model.DashboardModel;
import nl.hanze.designpatterns.mvc.view.menu.DashboardMenu;

public class DashboardController extends Controller<DashboardModel> {

	private DashboardGUI gui;
	
	public DashboardController(DashboardModel model, DashboardGUI gui) {
		super(model);
		this.setGUI(gui);
	}
	
	private void setGUI(DashboardGUI gui){
		this.gui = gui;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		System.out.println(e.getActionCommand());
		super.actionPerformed(e);
		switch (e.getActionCommand()) {
		case "menu_user_sign_out":
			Application.closeDashboardGUI();
			Application.startLoginGUI();
			break;
		case DashboardMenu.TROUBLE_TICKET_OVERVIEW:
			gui.loadView(gui.TROUBLE_TICKET_OVERVIEW);
			break;

		case DashboardMenu.TROUBLE_TICKET_ADD:
			gui.loadView(gui.TROUBLE_TICKET_ADD);
			break;
			
		case DashboardMenu.THESAURUS:
			gui.loadView(gui.THESAURUS);
			break;
		default:
			break;
		}
	}
}
